<template>
        <d2-crud-x
                ref="d2Crud"
                v-bind="_crudProps"
                v-on="_crudListeners"
                @authz="authzHandle">
          <div slot="header">
<!--            <crud-search ref="search" :options="crud.searchOptions" @submit="handleSearch"  />-->
            <el-button slot="header" size="small" type="primary" @click="addRow"><i class="el-icon-plus"/> 新增</el-button>
<!--            <crud-toolbar v-bind="_crudToolbarProps" v-on="_crudToolbarListeners"/>-->
          </div>

        </d2-crud-x>
</template>

<script>
import { crudOptions } from './crud'
import { d2CrudPlus } from 'd2-crud-plus'
import * as api from './api'
export default {
  mixins: [d2CrudPlus.crud],
  props:{
    dictId:[String,Number]
  },
  data () {
    return {

    }
  },
  watch:{
    dictId(){
      this.doRefresh()
    }
  },
  methods: {
    getCrudOptions () {
      return crudOptions(this)
    },
    pageRequest (query) {
      query.dictId = this.dictId
      return api.GetPage(query)
    },
    addRequest (row) {
      row.dictId = this.dictId
      return api.AddObj(row)
    },
    updateRequest (row) {
      row.dictId = this.dictId
      return api.UpdateObj(row)
    },
    delRequest (row) {
      return api.DelObj(row.id)
    },
    infoRequest (row) {
      return api.GetObj(row.id)
    },
  }
}
</script>
